import request from '@/utils/request';
import type { AxiosPromise } from '@/utils/request';
import type { ArrivalAcceptanceVO, ArrivalAcceptanceForm, ArrivalAcceptanceQuery } from '@/pagesA/api/workflow/arrivalAcceptance/types';

/**
 * 查询到货验收单列表
 * @param query
 * @returns {*}
 */

export const listArrivalAcceptance = (query?: ArrivalAcceptanceQuery): AxiosPromise<ArrivalAcceptanceVO[]> => {
  return request({
    url: '/workflow/arrivalAcceptance/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询到货验收单详细
 * @param id
 */
export const getArrivalAcceptance = (id: string | number): AxiosPromise<ArrivalAcceptanceVO> => {
  return request({
    url: '/workflow/arrivalAcceptance/' + id,
    method: 'get'
  });
};

/**
 * 新增到货验收单
 * @param data
 */
export const addArrivalAcceptance = (data: ArrivalAcceptanceForm) => {
  return request({
    url: '/workflow/arrivalAcceptance',
    method: 'post',
    data: data
  });
};

/**
 * 修改到货验收单
 * @param data
 */
export const updateArrivalAcceptance = (data: ArrivalAcceptanceForm) => {
  return request({
    url: '/workflow/arrivalAcceptance',
    method: 'put',
    data: data
  });
};

/**
 * 删除到货验收单
 * @param id
 */
export const delArrivalAcceptance = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workflow/arrivalAcceptance/' + id,
    method: 'delete'
  });
};
